package com.relax.netty.nio;

import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class NioTest3 {
    public static void main(String[] args) throws  Exception {
        FileOutputStream fileOutputStream = new FileOutputStream("bb.txt");
        FileChannel channel = fileOutputStream.getChannel();
        ByteBuffer byteBuffer = ByteBuffer.allocate(512);
        byte[] message="hello workd".getBytes();
        for (byte b : message) {
            byteBuffer.put(b);
        }

        byteBuffer.flip();
        channel.write(byteBuffer);

    }
}
